﻿@model ProductReviewOverviewModel
@using Nop.Web.Models.Catalog;

@{
    bool showcount = false;
    if (ViewData["ShowCount"] != null)
    {
        showcount = (bool)ViewData["ShowCount"];
    }   
}

@if (Model.RatingSum > 0 && Model.TotalReviews > 0)
{
    decimal ratePercent = (100 * Model.RatingSum) / (Model.TotalReviews * 5);
    @Html.Partial("_ProductReviewStars", new ProductReviewStarsModel() { 
        ShowCount = showcount,
        RatingPercent = ratePercent,
        TotalReviews = Model.TotalReviews
    })
}
else
{ 
    @Html.Partial("_ProductReviewStars", new ProductReviewStarsModel()
    {
        ShowCount = showcount,
        RatingPercent = 0,
        TotalReviews = Model.TotalReviews
    })
@*<span>There are currently no reviews. </span>*@
}
@*@if (Model.AllowCustomerReviews)
{
    if (Model.TotalReviews > 0)
    {
        <div class="product-has-reviews">
            <a href="@Url.RouteUrl("ProductReviews", new { productId = Model.ProductId })">@T("Reviews.Overview.AddNew")</a>
        </div>
    }
    else
    {
        <a class="first-reviewer" href="@Url.RouteUrl("ProductReviews", new { productId = Model.ProductId })">
            @T("Reviews.Overview.First")
        </a>
    }

}*@